package View;

import javax.swing.*;

import DAO.ModifyCourse;
import DAO.QueryByClass;
import DAO.ShowAll;
import java.awt.*;
import java.awt.event.*;

public class TeaFrame extends JFrame {
	private JPanel contentPane = new JPanel();
	private JButton btn_QueryOne, btn_QueryAll, btn_Modify, btn_Exit,btn_QueryClass;
	private JLabel lab_Tip;
	public static String teaCourse;

	public TeaFrame(String user) {
		setTitle("教师模式");
		setSize(500, 300);
		setLocationRelativeTo(null);
		setContentPane(contentPane);
		contentPane.setLayout(null);

		lab_Tip = new JLabel("请选择你要进行的操作：");
		lab_Tip.setBounds(20, 0, 200, 40);
		lab_Tip.setFont(new Font("宋体", Font.PLAIN, 16));
		contentPane.add(lab_Tip);

		btn_QueryOne = new JButton("查询成绩");
		btn_QueryOne.setBounds(80, 50, 120, 50);
		btn_QueryOne.setFont(new Font("宋体", Font.BOLD, 16));
		/* 添加按钮监听，点击进入查询成绩界面 */
		btn_QueryOne.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				new QueryFrame();
			}
		});
		contentPane.add(btn_QueryOne);

		btn_QueryAll = new JButton("查看成绩");
		btn_QueryAll.setBounds(290, 50, 120, 50);
		btn_QueryAll.setFont(new Font("宋体", Font.BOLD, 16));
		/* 添加按钮监听，点击展示所有学生所有成绩 */
		btn_QueryAll.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new ShowAll();
			}
		});
		contentPane.add(btn_QueryAll);

		btn_Modify = new JButton("录入成绩");
		btn_Modify.setBounds(80, 120, 120, 50);
		btn_Modify.setFont(new Font("宋体", Font.BOLD, 16));
		/* 添加按钮监听，点击修改该科目成绩 */
		btn_Modify.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				new ModifyCourse(user);
			}
		});
		contentPane.add(btn_Modify);
		btn_QueryClass = new JButton("班级成绩");
		btn_QueryClass.setBounds(290, 120, 120, 50);
		btn_QueryClass.setFont(new Font("宋体", Font.BOLD, 16));
		/* 退出按钮 监听 */
		btn_QueryClass.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				new QueryByClass();
			}
		});
		contentPane.add(btn_QueryClass);
		
		btn_Exit = new JButton("退出");
		btn_Exit.setBounds(185, 190, 120, 50);
		btn_Exit.setFont(new Font("宋体", Font.BOLD, 16));
		/* 退出按钮 监听 */
		btn_Exit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				System.exit(0);
			}
		});
		contentPane.add(btn_Exit);
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
	}
}


